<?php

if (!defined('PUBLIC_HTML'))
{
	exit;
}

$submit = (isset($_POST['submit'])) ? true : false;
$page_title = 'Add Menu Item';

if ($submit)
{
	$post = array();
	$post['page_id']	= (isset($_POST['page_id']))	? (int) $string->secure($_POST['page_id'], 'sql_single_field') : (int) 0;
	$post['link']		= (isset($_POST['mlink']))		? ((!empty($_POST['link']))		? (string) $string->secure($_POST['link'],		'sql_single_field') : '') 			: '';
	$post['target']		= (isset($_POST['target']))		? ((!empty($_POST['target']))	? (string) $string->secure($_POST['target'],	'sql_single_field') : '_self') 		: '_self';
	$post['title']		= (isset($_POST['title']))		? ((!empty($_POST['title']))	? (string) $string->secure($_POST['title'],		'sql_single_field') : 'undefined') 	: 'undefined';
	$post['lang']		= (isset($_POST['language']))	? ((!empty($_POST['language'])) ? (string) $string->secure($_POST['language'],	'sql_single_field') : 'en') 		: 'en';
	$post['type']		= 1;
	//$db->sql_insert_row(TABLE_MENU, $post, 'men_');
	$database->sqlInsert(TABLE_MENU, $post, 'men_');
	if (!$ajax)
	{
		redirect('cms.php?p=menu');
	}
	exit;
}

?>